#include<iostream>
#include<unistd.h>
#include<pthread.h>
using namespace std;

int val = 0;

void* threadRun1(void* ar)
{
    while(1)
    {
        cout<<"t1 pro pid:"<<getpid()<<"  val:"<<val++<<endl;
        sleep(1);

    }
}

void* threadRun2(void* ar)
{
    while(1)
    {
        sleep(1);
        cout<<"t2 pro pid:"<<getpid()<<"  &val:"<<&val<<"  val:"<<val<<endl;
    }
}

void* threadRun3(void* ar)
{
    while(1)
    {
        cout<<"t3 pro pid:"<<getpid()<<"val"<<val++<<endl;
        sleep(1);
    }
}

int main()
{
    pthread_t t1,t2,t3;
    pthread_create(&t1,nullptr,threadRun1,nullptr);
    //pthread_create(&t2,nullptr,threadRun2,nullptr);
    //pthread_create(&t3,nullptr,threadRun3,nullptr);



    while(1)
    {
        sleep(1);
        cout<<"main pro pid:"<<getpid()<<endl;
    }

    return 0;
}